package com.xuan.friend.controller.user;

import com.xuan.common.core.controller.BaseController;
import com.xuan.common.core.domain.PageRequest;
import com.xuan.common.core.domain.R;
import com.xuan.common.core.domain.TableDataInfo;
import com.xuan.common.core.exception.BusinessException;
import com.xuan.friend.service.user.UserMessageService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/user/message")
public class UserMessageController extends BaseController {


    @Resource
    private UserMessageService userMessageService;

    @GetMapping("/list")
    public TableDataInfo listContestMessage(PageRequest pageRequest) {
        return userMessageService.listContestMessage(pageRequest);
    }


    @DeleteMapping("/delete")
    public R<Void> deleteMessage(Long textId) {
        if (textId == null) {
            throw new BusinessException("参数为空");
        }
        return toR(userMessageService.deleteMessage(textId));
    }
}
